/**
 *
 */
package com.rexzhaolei.fizzbuzzwhizz;

import java.util.Iterator;
import java.util.Random;

/**
 * @author rex.zhao
 *
 */
public class Teacher {

	public Zz gameFizzBuzzWhizz() {
		Random rand = new Random(System.currentTimeMillis());
		int no1 = rand.nextInt(8) + 1;
		int no2 = rand.nextInt(8) + 1;
		while (no2 == no1) {
			no2 = rand.nextInt(8) + 1;
		}
		int no3 = rand.nextInt(8) + 1;
		while (no3 == no2 || no3 == no1) {
			no3 = rand.nextInt(8) + 1;
		}
		System.out.println("fizz:" + no1 + " buzz:" + no2 + " whizz:" + no3);
		return new Fizz(no1, new Buzz(no2, new Whizz(no3)));
	}

	public static void main(String[] args) {

		Teacher teacher = new Teacher();
		Students students = Students.newStudents(100);

		Iterator<Student> iterator = students.iterator();
		while (iterator.hasNext()) {
			Student student = iterator.next();
			System.out.println(student.say());
		}

		students.setZzGame(teacher.gameFizzBuzzWhizz());

		iterator = students.iterator();
		while (iterator.hasNext()) {
			Student student = iterator.next();
			System.out.println(student.say());
		}
	}
}
